package com.scud.product.controller;

import com.scud.common.result.Result;
import com.scud.model.product.pojo.Category;
import com.scud.product.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author vermouth
 */
@RestController()
@RequestMapping("/api/product/category")
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 获取分类列表
     * @param :
     * @return Result
     * @author vermouth
     */
    @GetMapping("list")
    public Result list(){
        log.info("获取分类列表");
        List<Category> categoryList=categoryService.list();
        return Result.success(categoryList);
    }
}
